#ifndef IAPSESSION_H
#define IAPSESSION_H

#include <e32base.h>
#include "iapclientadapter.h"

class IAPClientAdapter;

class CIAPSession : public CSession2,
                    public MIAPClientAdapterObserver
{
public:
    static CIAPSession* NewL(TInt aHostWin, TInt aSelfWin);

    // From CSession2
    void ServiceL( const RMessage2& aMessage );

    ~CIAPSession();

    //from MIAPClientAdapterObserver
    void Notify(int requestId, QString aMessage);
    void ProductDataNotify(int requestId,
                           QString productInformation,
                           QString description,
                           QString shortDescription,
                           QString price);

    void ClientAppFocusChanged(TInt eventCode);
private:
    CIAPSession(TInt aHostWin, TInt aSelfWin);
    void ConstructL();
    void giveUpControl();
    void CaptureControl();
    void ShowIdleScreen();
private:
    //data
    enum TControlStatus{
        EServiceBackground,
        EServiceForeground
    }   iCtrlStatus;
    /*
     * In-Application Purchase API
     */
    IAPClientAdapter                  *iap_client;
    RMessage2                         iMessage;
    TBool                             iIsbusy;
    TInt                              iHostWin;
    TInt                              iSelfWin;
};

#endif // IAPSESSION_H
